from google.appengine.ext import db

class Player(db.Model):
  user = db.UserProperty()
  nick = db.StringProperty()
  # created maps
  # programs written

class VirtualMachine(db.Model):
  codename = db.StringProperty()
  version = db.StringProperty()
  releaseDate = db.DateTimeProperty()

class Map(db.Model):
  name = db.StringProperty()
  author = db.ReferenceProperty(Player)
  comment = db.StringProperty(multiline=True)
  createdDate = db.DateTimeProperty(auto_now_add=True)
  maxMainInstructions = db.IntegerProperty()
  maxFunctions = db.IntegerProperty()
  data = db.StringProperty(multiline=True)
  virtualMachine = db.ReferenceProperty(VirtualMachine)
  # comments

class Program(db.Model):
  map = db.ReferenceProperty(Map)
  author = db.ReferenceProperty(Player)
  executedDate = db.DateTimeProperty(auto_now_add=True)
  statements = db.StringListProperty()
  executedStatements = db.IntegerProperty()
  success = db.BooleanProperty()
  successActivations = db.IntegerProperty()
  illegalOperations = db.IntegerProperty()
  postSuccessOperations = db.IntegerProperty()
  # comments

class Action(db.Model):
  actionKey = db.StringProperty()
  name = db.StringProperty()
  description = db.StringProperty(multiline=True)

class Tile(db.Model):
  tileKey = db.StringProperty()
  name = db.StringProperty()
  design = db.StringProperty()
  description = db.StringProperty(multiline=True)
  elevation = db.IntegerProperty()
